//
//  AppHelper.m
//  EnterpriseManagement
//
//  Created by Lwx on 16/10/28.
//  Copyright © 2016年 Lwx. All rights reserved.
//

#import "AppHelper.h"
#import "AppDelegate.h"
#import <UIKit/UIKit.h>
#import "AppNavgiationController.h"
#import "AppTabBarController.h"
#import "LoginViewController.h"
#import "NewFeatureViewController.h"
@implementation AppHelper

+ (void)showLogin
{
    LoginViewController *loginVC = [[LoginViewController alloc] init];
//    AppNavgiationController *navigation = [[AppNavgiationController alloc] initWithRootViewController:loginVC];
//    [[UIApplication sharedApplication] delegate].window.rootViewController = navigation;
//    [[[UIApplication sharedApplication] delegate].window makeKeyAndVisible];
//
//    CATransition *animation = [CATransition animation];
//    animation.type = kCATransitionFade;
//    [[[UIApplication sharedApplication] delegate].window.layer addAnimation:animation forKey:nil];
    
    [[LoginViewController getCurrentVC].navigationController pushViewController:loginVC animated:YES];
}

+ (void)showMain
{
//    //取出上次存储在沙河中的软件版本号
//    NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
//    NSString * lastVersion = [defaults stringForKey:@"CFBundleVersion"];
//    //获得当前软件的版本号
//    NSString * currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"];
    
//    if ([currentVersion isEqualToString:lastVersion]) {
        AppTabBarController *tabBarVC = [[AppTabBarController alloc]init];
        [[UIApplication sharedApplication] delegate].window.rootViewController = tabBarVC;
        [[[UIApplication sharedApplication] delegate].window makeKeyAndVisible];
//    }else{
//        NewFeatureViewController * newFeatureVC = [[NewFeatureViewController alloc] init];
//        [[UIApplication sharedApplication] delegate].window.rootViewController = newFeatureVC;
//        [[[UIApplication sharedApplication] delegate].window makeKeyAndVisible];
//
//        [defaults setObject:currentVersion forKey:@"CFBundleVersion"];
//        [defaults synchronize];
//    }
    
//    AppTabBarController *tabBarVC = [[AppTabBarController alloc]init];
//    [[UIApplication sharedApplication] delegate].window.rootViewController = tabBarVC;
//    [[[UIApplication sharedApplication] delegate].window makeKeyAndVisible];
    
    CATransition *anim = [CATransition animation];
    anim.type = @"moveIn";
    anim.subtype = kCATransitionFromRight;
    anim.duration = 0.3;
    [[[UIApplication sharedApplication] delegate].window.layer addAnimation:anim forKey:nil];
}


@end
